from __future__ import unicode_literals

lists = [1, 2, 2, 34, 4, 5, 4, 4, 4, 4, 234, 31, 43, 123421, 34, 124, 2, 421, 34, 124, 23, 432, 3, 4233, 42, 4, 24, 343,
         3, 3, 4, 43, 341, 43, 4, 34, 3, 41, 4, 134, 14, 1, 412, 4, 124, 1234234, 12, 412, 4, 12, 412, 34, 1, 41, 24,
         1234, 34]
for x in lists:
    # print(x)
    if (x > 10000):
        print(x)
print('————————————————————————————————————')
# 以上代码应输出
# 123421
# 1234234
# ————————————————————————————————————

print('list内共有：' + str(len(lists)) + '个元素')
print('————————————————————————————————————')
# 以上代码应输出
# list内共有：57个元素
# ————————————————————————————————————

王朝 = {'身高': 168, '年龄': 32, '体重': '65Kg'}
print(王朝)
print('————————————————————————————————————')
# 以上代码应输出
# {'身高': 168, '年龄': 32, '体重': '82Kg'}
# ————————————————————————————————————

age = 20
name = '王改朝'

# 使用下标
print('{1} was {0} years old when he wrote this book.'.format(name, age))
print('{0} was {1} years old when he wrote this book.'.format(name, age))
print('Why is {0} playing with that python?'.format(name))
print('————————————————————————————————————')
# 以上代码应输出
# 20 was 王改朝 years old when he wrote this book.
# 王改朝 was 20 years old when he wrote this book.
# Why is 王改朝 playing with that python?
# ————————————————————————————————————

# 可以不使用
print("{} was {} years old when he wrote this book.".format(name, age))
print("Why is {} playing with that python?".format(name))
print('————————————————————————————————————')
# 以上代码应输出
# 王改朝 was 20 years old when he wrote this book.
# Why is 王改朝 playing with that python?
# ————————————————————————————————————

# 可以使用关键词
print("{name} was {age} years old when he wrote this book.".format(name='王浩', age=18))
print("Why is {name} playing with that python?".format(name='王晨晨'))
print('————————————————————————————————————')
# 以上代码应输出
# 王浩 was 18 years old when he wrote this book.
# Why is 王晨晨 playing with that python?
# ————————————————————————————————————

# 使用变量
str_1 = '{} was {} years old when he wrote this book.'
str_2 = '{} 很好'
print(str_1.format(name, age))
print(str_2.format(name))
print('————————————————————————————————————')
# 以上代码应输出
# 王改朝 was 20 years old when he wrote this book.
# 王改朝 很好
# ————————————————————————————————————

# 保留三位小数
print('{0:.3f}'.format(100 / 7))
print('{0:.3f}'.format(200.0 / 7))
print('————————————————————————————————————')
# 以上代码应输出
# 14.286
# 28.571
# ————————————————————————————————————

# 填充 使用'#'填充字符串'hello',且字符串居中,填充后总长度为 11
# todo 左侧填充/右侧填充
print('{0:#^11}'.format('hello'))
print('————————————————————————————————————')
# 以上代码应输出
# ###hello###
# ————————————————————————————————————

# print 结尾是以 '\n' 结尾 可以使用参数
print(name, end='')
print(age, end='')
print('##end')
print('————————————————————————————————————')
# 以上代码应输出
# 王改朝20##end
# ————————————————————————————————————

# 转义字符 反斜杠'\'、'\n'(换行)、'\t'(制表符)
# 比如 字符串 “What's your name?”
print('What\'s your name?')
print('What\'s your name?\n')
print('What\'s your name?\tMy name is Hanmeimei')
print('————————————————————————————————————')
# 以上代码应输出
# What's your name?
# What's your name?
#
# What's your name? My name is Hanmeimei
# ————————————————————————————————————

# 使用关键字 r 输出原始(Raw)字符
print(r"Newlines are indicated by \n")
print('————————————————————————————————————')
# 以上代码应输出
# Newlines are indicated by \n
# ————————————————————————————————————

# 定义多行文本
s = 'This is a string. ' \
    'This continues the string.'
print(s)
print('————————————————————————————————————')
# 以上代码应输出
# This is a string. This continues the string.
# ————————————————————————————————————

# 换行定义变量
i = \
    5
print(i)
print('————————————————————————————————————')
# 以上代码应输出
# 5
# ————————————————————————————————————

# #### 运算符与表达式

